<?php
	function mload($filename) {
		$con = file_get_contents($filename);
		$con = str_replace("\n","§testo  ",$con);
		$con = explode("§",$con);
		$doc = array();
		$int = 0;
		foreach($con as $item) {
			$poss = strpos($item," ");
			$toke = substr($item,0,$poss);
			if (!isset($doc[$toke])) {
				$doc[$toke] = substr($item,$poss+1);
			} else {
				$doc[$toke.":".$int] = substr($item,$poss+1);
			}	
			$int++;		
		}
		return $doc;
	}
	
	function msave($filename,$doc) {
		$txt = "";
		foreach($doc as $key=>$value) {
			$key = explode(":",$key);
			$key = $key[0];
			$value = trim($value);
			if ($value != "") {
				$txt.="§".strtolower($key)." ".trim($value)."\n";
			}
		}
		file_put_contents($filename,$txt);
	}
?>
